package es.ceura.wilder.datastructures.request;

import es.ceura.wilder.datastructures.HeaderType;
import es.ceura.wilder.datastructures.Header;
import es.ceura.wilder.actions.ActionType;
import java.util.HashMap;

/**
 *
 * @author Jorge Madrid
 */
public class HTTPRequest {

    private final StatusLine statusLine;
    private HashMap<HeaderType, Header> headerMap;
    private String message;

    public HTTPRequest(StatusLine statusLine,
            HashMap<HeaderType, Header> headerMap,
            String message) {
        this.statusLine = statusLine;
        this.headerMap = headerMap;
        this.message = message;
    }

    public ActionType getHttpMethod() {
        return statusLine.httpMethod;
    }

    public StatusLine getStatusLine() {
        return statusLine;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Header getHeaderValue(HeaderType key) {
        return headerMap.get(key);
    }

    public void putHeader(HeaderType key, Header value) {
        headerMap.put(key, value);
    }

    @Override
    public String toString() {
        return "HTTPRequest{" + "statusLine=" + statusLine + ", headerMap=" + headerMap + ", message=" + message + '}';
    }
}
